package priv.yiyuan.example.design.visitor.decorator;

import priv.yiyuan.example.design.visitor.ConfigurationVisitor;
import priv.yiyuan.example.design.visitor.DatabaseConfig;
import priv.yiyuan.example.design.visitor.NetworkConfig;

/**
 * 具体装饰器实现类 日志记录装饰器
 *
 * @author YiYuan
 * @data 2025/8/4
 * @apoNote
 */
public class LoggingVisitorDecorator extends ConfigurationVisitorDecorator {

    public LoggingVisitorDecorator(ConfigurationVisitor decoratedVisitor) {
        super(decoratedVisitor);
    }

    @Override
    public void visit(DatabaseConfig element) {

        System.out.println("Logging: Entering visit(DatabaseConfig)");
        super.visit(element);
        System.out.println("Logging: Exiting visit(DatabaseConfig)");

    }

    @Override
    public void visit(NetworkConfig element) {

        System.out.println("Logging: Entering visit(NetworkConfig)");
        super.visit(element);
        System.out.println("Logging: Exiting visit(NetworkConfig)");

    }

}
